const axios = require('axios')
const TOKEN = "028787eced43b6b5ea9157377a0cea3104833437"

const service = axios.create({
  baseURL: "https://api.github.com",
  timeout: 15000
})

service.interceptors.request.use(
  config => {
      let token = TOKEN
      if (token) {
          let sp = "?"
          if (config.url.indexOf("?") >= 0) {
              sp = "&"
          }
          config.url = config.url + sp + "access_token=" + token
      }
      return config
  },
  error => {

  }
)

// export default service
module.exports = service
